package cn.ssj.controller;

import cn.ssj.entity.Staff;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Administrator on 2017-09-10.
 */
@RestController
@EnableAutoConfiguration
public class StaffController extends BaseController<Staff,Integer>{

    @RequestMapping("/back/addStaff")
    public String add(Staff entity) {
        return super.add(entity);
    }

    @RequestMapping("/back/updateStaff")
    public String update(Staff entity) {
        return super.update(entity);
    }

    @RequestMapping("/back/deleteStaff")
    public String delete(@RequestParam("ids[]") Integer[] integers) {
        return super.delete(integers);
    }

    @RequestMapping("/back/queryAllStaffByPage")
    public String queryAllByPage(Integer pageNumber) {
        return super.queryAllByPage(pageNumber);
    }

    @RequestMapping("/back/staffUpload")
    public String upload(MultipartFile file, HttpServletRequest request) {
        super.setLocationPath(getLocationPath()+"staff");
        super.setHandlerPath(getHandlerPath()+"staff");
        return super.upload(file, request);
    }
}
